package com.lejin.order.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lejin.order.entity.OrderInfo;
import com.lejin.order.entity.OrderPay;
import com.lejin.order.mapper.CourseOrderPayMapper;
import com.lejin.order.service.ICourseOrderPayService;
import com.lejin.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class CourseOrderPayServiceImpl extends ServiceImpl<CourseOrderPayMapper, OrderPay> implements ICourseOrderPayService {
    @Autowired
    private CourseOrderPayMapper courseOrderPayMapper;
    @Override
    public String saveOrderPay(OrderInfo orderInfo) {
        OrderPay orderPay = new OrderPay();
        orderPay.setCourseName(orderInfo.getCourseName());
        orderPay.setGmtCreate(new Date());
        orderPay.setOrderId(orderInfo.getOrderNumber());
        orderPay.setCoursePrice(orderInfo.getPricePaid());
        orderPay.setOrderStatus(2);
        int insert = courseOrderPayMapper.insert(orderPay);
        return orderInfo.getOrderNumber();
    }
}
